﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace exerciseEight
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("请输入身份证号：");
            string instr = Console.ReadLine();
            int temp = 0;
            if (instr.Length==18)
            {
                foreach (char ch in instr)
                {
                    if (char.IsLetter(ch))
                    {
                        Console.WriteLine("存在非数字字符，请重新输入");
                        temp = 1;
                        break;
                    }
                }
                if (temp==1)
                {
                    Console.Write("");
                }
                else
                {
                    Console.WriteLine("输入正确");
                }
            }
            else
            {
                Console.WriteLine("长度不是18位，请重新输入");
                foreach (char ch in instr)
                {
                    if (char.IsLetter(ch))
                    {
                        Console.WriteLine("存在非数字字符，请重新输入");
                        temp = 1;
                        break;
                    }
                }
            }
            Console.ReadKey();
        }
    }
}
